/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86136
 * Date: 2025-04-07
 * Time: 14:20
 */
public class Demo15 {
    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            for (int i = 0; i < 3000; i++) {
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("t线程结束");
        });
        t.start();
        try {
            t.join();//超时时间(等待的最大时间)
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("main线程结束");

    }
}
